<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"

      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h:form id="cepForm" enctype="multipart/form-data">
                <h1 class="title">Escrituras de Testamento</h1>
                <p:growl id="messages" showDetail="true" autoUpdate="true" /> 
                <div class="row">
                    <div class="twelve columns"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Visualização</h4></legend>
                            <p:panel id="charterPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">
                                <p:outputLabel value="Número: " styleClass="grid_3"/>
                                <h:outputText styleClass="grid_8"  value="#{managerSearchRcto.charterShow.esc}" />  
                                
                                <div class="clear"/>
                                
                                <p:outputLabel value="Tipo Ato: " styleClass="grid_3"/>
                                <h:outputText styleClass="grid_8"  value="#{managerSearchRcto.charterShow.actCep.description}" />  


                                <p:outputLabel value="Data Ato: " styleClass="grid_4"/>
                                <h:outputText styleClass="grid_8" style="width:32.44%"
                                              value="#{managerSearchRcto.charterShow.dateTest}">
                                    <f:convertDateTime pattern="dd/MM/yyyy"/>
                                </h:outputText>

                                <div class="clear"/>

                                <p:outputLabel value="Livro: " styleClass="grid_3" />
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.book}"/>

                                <p:outputLabel value="Livro Compl.: " styleClass="grid_4"/>
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.bookComp}"/> 

                                <div class="clear"/>

                                <p:outputLabel value="Folha: " styleClass="grid_3" />
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.leaf}"/> 

                                <p:outputLabel value="Folha Compl.: " styleClass="grid_4"/>
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.leafComp}"/> 


                                <div class="clear"/>
                                <p:outputLabel value="Objeto: " styleClass="grid_3"/>
                                <h:outputText  styleClass="grid_20" value="#{managerSearchRcto.charterShow.obs}"/> 


                                <fieldset>
                                    <legend> <h4 style="font-size: 10px;margin:0 0 10px 0">Revogação</h4></legend>
                                    <div class="clear"/>

                                    <p:outputLabel value="Data do Ato Revogado: " styleClass="grid_3"/>
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationDateTest}">
                                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                                    </h:outputText>


                                    <div class="clear"/>

                                    <p:outputLabel value="Livro: " styleClass="grid_3" />
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationBook}"/>

                                    <p:outputLabel value="Livro Compl.: " styleClass="grid_4"/>
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationBookComp}"/> 

                                    <div class="clear"/>

                                    <p:outputLabel value="Folha: " styleClass="grid_3" />
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationLeaf}"/> 

                                    <p:outputLabel value="Folha Compl.: " styleClass="grid_4"/>
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationLeafComp}"/> 

                                    <div class="clear"/>

                                    <p:outputLabel value="Cidade: " styleClass="grid_3"/>
                                    <h:outputText styleClass="grid_8"  value="#{managerSearchRcto.charterShow.revocationCity.name}"/> 

                                    <p:outputLabel value="Estado: " styleClass="grid_4"/>
                                    <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.revocationUF}"/>

                                    <div class="clear"/>
                                    <p:outputLabel value="Cartório: " styleClass="grid_3"/>
                                    <h:outputText  styleClass="grid_20" value="#{managerSearchRcto.charterShow.revocationNottaryOffice}" />
                                </fieldset>


                            </p:panel>

                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">TESTADOR</h4></legend>

                            <p:panel id="partsPanel" style="background: none; border: none;" styleClass="container_24 clearfix ">

                                <p:outputLabel id="typeDocumentLabel" 
                                               value="CPF: " 
                                               styleClass="grid_3"/>

                                <h:outputText id="typeDocumentInput" 
                                              value="#{managerSearchRcto.charterShow.people.cpf}"
                                              styleClass="grid_8" />

                                <div class="clear"/>

                                <p:outputLabel value="Nome:" styleClass="grid_3" />
                                <h:outputText styleClass="grid_20" 
                                              value="#{managerSearchRcto.charterShow.people.name}"/> 

                                <div class="clear"/>

                                <p:outputLabel value="RG: "  styleClass="grid_3"/>
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.people.rg}"/> 

                                <p:outputLabel value="Orgão emissor: "  styleClass="grid_4"/>
                                <h:outputText styleClass="grid_8" value="#{managerSearchRcto.charterShow.people.organ}"/> 

                                <div class="clear"/>

                                <p:outputLabel value="Data nasc: "  styleClass="grid_3"/>
                                <h:outputText styleClass="grid_8" 
                                              value="#{managerSearchRcto.charterShow.people.nasc}"> 
                                    <f:convertDateTime pattern="dd/MM/yyyy"/>
                                </h:outputText>

                                <div class="clear"/>
                                <p:outputLabel value="Pai:" styleClass="grid_3" />
                                <h:outputText styleClass="grid_20" 
                                              value="#{managerSearchRcto.charterShow.people.father}"/> 

                                <div class="clear"/>
                                <p:outputLabel value="Mãe:" styleClass="grid_3" />
                                <h:outputText styleClass="grid_20" 
                                              value="#{managerSearchRcto.charterShow.people.mother}"/> 


                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Selos</h4></legend>

                            <p:panel id="stampPanel" 
                                     style="background: none; border: none;" styleClass="container_24 clearfix ">


                                <p:dataTable id="dataTableStamps"
                                             value="#{managerSearchRcto.charterShow.stamp}"
                                             var="stampTable"
                                             emptyMessage="Nenhum registro encontrado" >
                                    <f:facet name="header">
                                        Selos
                                    </f:facet>
                                    <p:column headerText="Série">
                                        #{stampTable.serie}
                                    </p:column>
                                    <p:column headerText="Número">
                                        #{stampTable.number}
                                    </p:column>
                                    <p:column headerText="Tipo">
                                        #{stampTable.typeStamp.name}
                                    </p:column>

                                </p:dataTable>
                            </p:panel>
                        </fieldset>
                        <br/>

                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Anexos</h4></legend>
                            <ui:repeat  value="#{managerSearchRcto.charterShow.annex}" var="a">
                                <h:outputLink  
                                    value="#{a.type ne 'application/pdf' ? 'viewImage':'show'}" title="#{a.description}"  target="_blank" >

                                    <div style="text-align: center; width: 20%;" class="grid_4">

                                        <p:graphicImage styleClass="image grid_3" rendered="#{a.type ne 'application/pdf'}"
                                                        style="margin-left:1%; width: 100px;"
                                                        url="show/?annex=#{a.id}" />

                                        <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                 a.description.replace('.png','').replace(' ','_')}" 
                                                        style="margin-left:1%; width: 100px;" rendered="#{a.type ne 'application/pdf'}"/>

                                        <p:graphicImage styleClass="image grid_3" rendered="#{a.type eq 'application/pdf'}"
                                                        style="margin-left:1%; width: 100px;" 
                                                        url="assets/images/pdf.jpeg" />


                                        <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                 a.description.replace('.pdf','').replace(' ','_')}" 
                                                        style="margin-left:1%; width: 100px;" rendered="#{a.type eq 'application/pdf'}"/>
                                    </div>
                                    <f:param name="annex" value="#{a.id}"/>
                                </h:outputLink>
                            </ui:repeat>
                        </fieldset>    


                        <div class="buttonAction">
                            <p:button value="Voltar" icon="ui-icon-arrowreturnthick-1-w" href="searchRcto.xhtml" styleClass="ui-priority-primary" />
                        </div >
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>